﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Interfaces.CommonData;

namespace StockInfoLoader.Utils
{
    internal class UrlHelper
    {
        private const string YAHOO_URL_PRICES_PLACEHOLDER = "http://real-chart.finance.yahoo.com/table.csv?s={0}&a={1}&b={2}&c={3}&d={4}&e={5}&f={6}&g=d&ignore=.csv";

        public enum Sources
        {
            YAHOO
        };

        public static string GetPriceUrl(Sources src, string ticker, DateInterval dtInterval)
        {
            // Will implement other sources later if needed
            string url = string.Format(YAHOO_URL_PRICES_PLACEHOLDER
                ,   ticker
                ,   dtInterval.DateFrom.Month - 1
                ,   dtInterval.DateFrom.Day
                ,   dtInterval.DateFrom.Year
                ,   dtInterval.DateTo.Month -1
                ,   dtInterval.DateTo.Day
                ,   dtInterval.DateTo.Year);
            return url;
        }

    }
}
